/**
 * Class that reads the contents of the folder assets/images and returns it back
 * as a string array.
 *
 * NOTE: Copy this class into DummyContent.  This class depends on being internal to 
 * DummyContent.  Do not try to use it unmodified as a freestanding class.
 *
 * TIP: In Eclipse, select "Source > Organize Imports".
 */
public static class ListAssetsTask extends AsyncTask<Context, Void, Void> {
    static final String ASSET_IMG_DIR = "images";

    @Override
    protected Void doInBackground(Context... params) {
	    String[] starrAssetFiles = null;
        Context context = params[0];
        AssetManager assetManager = context.getAssets();

        try {
            starrAssetFiles = assetManager.list(ASSET_IMG_DIR);
        } catch (IOException e) {
            Log.e("tag", e.getMessage());
        }

        for (String filename : starrAssetFiles) {
            addItem(new DummyItem(filename, ASSET_IMG_DIR + java.io.File.separator + filename));
        }

        return null;
    }
} // ListAssetsTask

/**
 * Call ListAssetsTask during initialization of list Activity.
 * Copy this code into DummyContent in place of the existing
 * static { ... } initialization block.
 */
public static boolean initialized;

static {
    initialized = false;
}

public static void Init(Context context) {
    if (!initialized) {
        new ListAssetsTask().execute(context);
        initialized = true;
    }
}

/**
 * Invoke Init during PicListActivity.onCreate().
 */
//public void onCreate(Bundle savedInstanceState) {
//    super.onCreate(savedInstanceState);
    
    // --- Insert the statement below ---
    // Initialize our dummy data
    DummyContent.Init(this);
//    ...
//}
